import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
@Entity("goods")
export class GoodsEntity{
  @PrimaryGeneratedColumn()
  id: number

  @Column({
    type:'int',
    nullable: false,
    name:'business_id',
    comment:'卖家id'
  })
  businessId:number

  @Column({
    type:'int',
    nullable: true,
    name:'buyer',
    comment:'买家id'
  })
  buyer:number

  @Column({
    type:'varchar',
    nullable: false,
    length:255,
    name:'good_name',
    comment:'物品名称'
  })
  goodName:string

  @Column({
    type: 'timestamp',
    nullable: false,
    name: 'publish_date',
    comment: '上架时间',
    default: () => 'CURRENT_TIMESTAMP', // 设置默认值为当前时间戳
  })
  publishDate: Date;

  @Column({
    type:'int',
    nullable: false,
    name:'state',
    comment:'状态(0：已上架，1：已完成)',
    default: 0,
  })
  state:number


  @Column({
    type:'varchar',
    nullable: false,
    length:255,
    name:'img_addr',
    comment:'物品图片'
  })
  imgAddr:string

  @Column({
    type: 'decimal',
    precision: 10, // 总位数
    scale: 2,      // 小数点后的位数
    nullable: false,
    default: 0,    // 默认值为 0.00
    comment: '物品价格',
  })
  price: number;

}
